#define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>
int quick_sort(int a[], int l, int r, int k)
{
    if (l == r)return a[l];
    int i = l, j = r;
    int t = a[(l + r) / 2];
    while (i < j)
    {
        while (a[i] > t)i++;
        while (a[j] < t)j--;
        if (i<j)
        {
            int tmp = a[j];
            a[j] = a[i];
            a[i] = tmp;
            i++;
            j--;
        }
        if (k <= j)return quick_sort(a, l, j, k);
        else return quick_sort(a, j + 1, r, k);
    }
}
int main()

{
    int n;
    int a[100000];
    scanf("%d", &n);
    for (int i = 1;i <= n;i++)
    {
        scanf("%d", &a[i]);
    }
    int m;
    scanf("%d", &m);
    while (m--)
    {
        int x;
        scanf("%d", &x);
        printf("%d\n", quick_sort(a, 1, n, x));
    }
    return 0;
}